import { useState,useRef } from 'react'
import Child from './Child.jsx'
export default function Parent(){
    const[list,setlist] = useState(['html','js','ts'])
    const inputRef = useRef(null)
    const handler = ()=>{
       console.log(inputRef.current.value)
       setlist([...list,inputRef.current.value])
    }
    return(
        <div>
            <div className="hd">
                <input type="text" ref={inputRef} />
                <button onClick={handler}>确认</button>
            </div>
            <Child list={list} />
        </div>
    )
}